﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Configuration;
using System.Data.SqlClient;
using DataAccessComponents;
using BusinessLogicLayer;
namespace inzWeb
{
    public partial class GetImage : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];
            pobierzZdjecie(id);
        }

        private void pobierzZdjecie(string idzdjecia)
        {
            int id = Convert.ToInt32(idzdjecia);
            ZdjecieBL zdjeciaBL = new ZdjecieBL();

            byte[] imgData = zdjeciaBL.pobierz(id).Zdjecie1;
            if(imgData==null)
                imgData = new byte[0];

            Response.BinaryWrite(imgData);

            //Response.ContentType = (r["obrazekTyp"].ToString());

            Response.OutputStream.Write(imgData, 0, imgData.Length);
        }
    }

}
